package com.py.korona.ui.listeners;

import android.app.ActionBar.Tab;
import android.app.ActionBar.TabListener;
import android.app.Fragment;
import android.app.FragmentTransaction;

public class CustomTabListener implements TabListener {
	private int containerViewId_;
	private Fragment fragment_;

	public CustomTabListener(Fragment fragment, int containerViewId) {
		fragment_ = fragment;
		containerViewId_ = containerViewId;
	}

	@Override
	public void onTabReselected(Tab tab, FragmentTransaction fragmentTransaction) {
	}

	@Override
	public void onTabSelected(Tab tab, FragmentTransaction fragmentTransaction) {
		fragmentTransaction.add(containerViewId_, fragment_);
	}

	@Override
	public void onTabUnselected(Tab tab, FragmentTransaction fragmentTransaction) {
		fragmentTransaction.remove(fragment_);
	}
}
